#ifndef _CONFIG_H
#define _CONFIG_H

#include <stdio.h>

typedef enum
{
    I_FILE_OPENLID,
    I_FILE_CLOSELID,
    I_FILE_XR,
    I_FILE_BATH,
    I_FILE_TRANS,
    I_FILE_DP8,
    I_FILE_THREMAL_SEAL,
    I_FILE_DJ,    
    I_MODULE_BASHMOVE,
    I_MODULE_DP8SUCK,
    I_MODULE_DP8DROPTIP,
    I_MODULE_DP8SPIT,
    I_MODULE_DP8ONTIP,
    I_MODULE_XR,
    I_MODULE_BATHZMOVE,
    I_MODULE_DJLIQUID,
    I_MODULE_DJREAGENT,
    I_MODULE_DP1TRANSTUBE,
    I_MODULE_DP8SUCK_AB,       
    MAX_CONFIG_FILE_NUM,
    I_MODULE_DP8LLD,
    I_MODULE_DP8SAMPLE,
    I_MODULE_BATH1ZMOVE,
}en_config_file;

#define FILE_DJ_TRACE "/mnt/nandflash/apps/config/dj_trace.txt"

extern const char * configFile[MAX_CONFIG_FILE_NUM];

typedef struct _paramEleEleCtl
{
    int sid;
    int speed;
    int acc;
    int dec;
    int position;
    int preWait;
    char dir_relative;
}paramEleCtl;

typedef struct _paramProcNode
{
    int numEleCtl;
    paramEleCtl * ptrNodeHead;
}paramProcNode;


typedef struct _djcleanParamCtl
{
    int stepNum;
    int eleType;   
}djcleanParamCtl;

int getEleCtlIdByString(const char * eleCtlName);

int read_param_xml(int fileId,const char* pathInXml,void * paramOut);

int modify_param_xml(int fileId,const char* pathInXml,void * paramIn);

int modify_djreagent_xml(const void * paramIn);

int read_param_json(int fileId,const char* pathInJson,void * paramOut,void * paramIn);

int read_param_json_djpump(int fileId,const char* pathInJson,void * paramOut,void * paramIn);

int convertEleCtlId(int sidIn);

//for openlid step1, goto scan
void openlid_gotoscan_read_param(void * dataOut,void * dataIn);

int openlid_gotoscan_act(void * dataIn);
int openlid_gotoscan_update(void * dataIn,void * stdData);
void openlid_gotoscan_query(void * dataIn);

void openlid_scan_read_param(void * dataOut,void * dataIn);

int openlid_scan_act(void * dataIn);
int openlid_scan_update(void * dataIn,void * stdData);
void openlid_scan_query(void * dataIn);

void openlid_gotoopen_read_param(void * dataOut,void * dataIn);

int openlid_gotoopen_act(void * dataIn);
int openlid_gotoopen_update(void * dataIn,void * stdData);
void openlid_gotoopen_query(void * dataIn);

void openlid_godown_read_param(void * dataOut,void * dataIn);

int openlid_godown_act(void * dataIn);
int openlid_godown_update(void * dataIn,void * stdData);
void openlid_godown_query(void * dataIn);

void openlid_jawlid_read_param(void * dataOut,void * dataIn);
int openlid_jawlid_act(void * dataIn);
int openlid_jawlid_update(void * dataIn,void * stdData);
void openlid_jawlid_query(void * dataIn);

void openlid_goup_read_param(void * dataOut,void * dataIn);
int openlid_goup_act(void * dataIn);
int openlid_goup_update(void * dataIn,void * stdData);
void openlid_goup_query(void * dataIn);

void openlid_goreset_read_param(void * dataOut,void * dataIn);
int openlid_goreset_act(void * dataIn);
int openlid_goreset_update(void * dataIn,void * stdData);
void openlid_goreset_query(void * dataIn);
void openlid_goreset_pre_read_param(void * dataOut,void * dataIn);

void closelid_goopen_read_param(void * dataOut,void * dataIn);
void closelid_godown_read_param(void * dataOut,void * dataIn);
void closelid_jawlid_open_read_param(void * dataOut,void * dataIn);
void closelid_goup_read_param(void * dataOut,void * dataIn);
void closelid_goreset_pre_read_param(void * dataOut,void * dataIn);
void closelid_goreset_read_param(void * dataOut,void * dataIn);

int lid_operation_act(void * dataIn);

void xrAtoB_gotoB_read_param(void * dataOut,void * dataIn);
void xrAtoB_godown_read_param(void * dataOut,void * dataIn);
void xrAtoB_jawclose_read_param(void * dataOut,void * dataIn);
void xrAtoB_rotate_read_param(void * dataOut,void * dataIn);
void xrAtoB_jawopen_read_param(void * dataOut,void * dataIn);
void xrAtoB_goup_read_param(void * dataOut,void * dataIn);

void bash_read_param(void * dataOut,void * dataIn);

void trans_gotoYend_read_param(void * dataOut,void * dataIn);
void trans_godown_read_param(void * dataOut,void * dataIn);
void trans_jawclose_read_param(void * dataOut,void * dataIn);
void trans_goup_read_param(void * dataOut,void * dataIn);
void trans_gotoYstart_read_param(void * dataOut,void * dataIn);
void trans_bashgodown_read_param(void * dataOut,void * dataIn);
void trans_xgoend_read_param(void * dataOut,void * dataIn);
void trans_jawopen_read_param(void * dataOut,void * dataIn);
void trans_xgotoheat_read_param(void * dataOut,void * dataIn);
void trans_bashgoup_read_param(void * dataOut,void * dataIn);
void trans_goreset_read_param(void * dataOut,void * dataIn);

void bashmove_bashgodown_read_param(void * dataOut,void * dataIn);
void bashmove_xgoend_read_param(void * dataOut,void * dataIn);
void bashmove_xgotoheat_read_param(void * dataOut,void * dataIn);
void bashmove_bashgoup_read_param(void * dataOut,void * dataIn);

int trans_goreset_update(void * dataIn,void * stdData);

void configOpenlid(void * procIn);

void set_check_data(void * dataIn,void ** dataOut);
int check_update(void * dataIn,void * stdData);
int isAllAckFinished(void *dataToCheck);

void dp8_zret_read_param(void * dataOut,void * dataIn);
void dp8_loc_horizen_read_param(void * dataOut,void * dataIn);
void dp8_loc_vertical_read_param(void * dataOut,void * dataIn);
void dp8_probe_read_param(void * dataOut,void * dataIn);
void dp8_suckact_read_param(void * dataOut,void * dataIn);
void dp8_suckend_read_param(void * dataOut,void * dataIn);

void dp8_droptip_down_read_param(void * dataOut,void * dataIn);
void dp8_droptip_up_read_param(void * dataOut,void * dataIn);

void dp8_split_down_read_param(void * dataOut,void * dataIn);
void dp8_split_up_read_param(void * dataOut,void * dataIn);

void dp8_ontip_down_read_param(void * dataOut,void * dataIn);
void dp8_ontip_up_read_param(void * dataOut,void * dataIn);

int dp8_move_xy(void * dataIn);

void xr_gotoStartY2_read_param(void * dataOut,void * dataIn);
void xr_gotoStartY_read_param(void * dataOut,void * dataIn);
void xr_startRotate_read_param(void * dataOut,void * dataIn);
void xr_startDown_read_param(void * dataOut,void * dataIn);
void xr_jawclose_read_param(void * dataOut,void * dataIn);
void xr_rotate_read_param(void * dataOut,void * dataIn);
void xr_gotoTarY_read_param(void * dataOut,void * dataIn);
void xr_gotoTarY2_read_param(void * dataOut,void * dataIn);
void xr_downTar_read_param(void * dataOut,void * dataIn);
void xr_jawopen_read_param(void * dataOut,void * dataIn);
void xr_goreset_read_param(void * dataOut,void * dataIn);
void xr_goreset2_read_param(void * dataOut,void * dataIn);

void heatSeal_gotosafe_read_param(void * dataOut,void * dataIn);
void heatSeal_xrRotate_read_param(void * dataOut,void * dataIn);
void heatSeal_gotoheat_read_param(void * dataOut,void * dataIn);
void heatSeal_heatdown_read_param(void * dataOut,void * dataIn);
void heatSeal_heatup_read_param(void * dataOut,void * dataIn);
void heatSeal_goreset_read_param(void * dataOut,void * dataIn);
void heatSeal_rotate_reset_read_param(void * dataOut,void * dataIn);


void bashzmove_read_param(void * dataOut,void * dataIn);
void bash1zmove_read_param(void * dataOut,void * dataIn);

int liquid_probe_act(void * dataIn);
int liquid_suck_act(void * dataIn);

void djclean_read_param(void * dataOut,void * dataIn);

void djreagnet_reset0_read_param(void * dataOut,void * dataIn);
void djreagnet_gotoreagent_read_param(void * dataOut,void * dataIn);
void djreagnet_suck_air_read_param(void * dataOut,void * dataIn);
void djreagnet_zgodown_read_param(void * dataOut,void * dataIn);
void djreagnet_suck_reagent_read_param(void * dataOut,void * dataIn);
void djreagnet_spit_reagent_read_param(void * dataOut,void * dataIn);
void djreagnet_zreset_read_param(void * dataOut,void * dataIn);

int dj_pump_suck_act(void * dataIn);
int dj_pump_spit_act(void * dataIn);

void transtube_jawzret_read_param(void * dataOut,void * dataIn);
void transtube_gotosrc_read_param(void * dataOut,void * dataIn);
void transtube_jawzdown1_read_param(void * dataOut,void * dataIn);
void transtube_dp1jawclose_read_param(void * dataOut,void * dataIn);
void transtube_jawzup1_read_param(void * dataOut,void * dataIn);
void transtube_gototar_read_param(void * dataOut,void * dataIn);
void transtube_jawzdown2_read_param(void * dataOut,void * dataIn);
void transtube_dp1jawopen_read_param(void * dataOut,void * dataIn);
void transtube_jawzup2_read_param(void * dataOut,void * dataIn);

int dp1_jaw_act(void * dataIn);

void * dp8_lld_threadfunc(void * dataIn);
void * funcDp1Jaw(void * paramIn);
void * funcSampleCap(void * paramIn );
//typedef void (*except_proc)(void);

extern FILE * g_fp_z;

#endif